﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SH.Common.CommonReturn;
using SH.Order.Domain.OrderClass;
using SH.Room.Application.IServices.IRoomState;
using SH.Room.Domain.RoomClass;
using SH.Room.Infrastructure.IRepository.Dto;
using System.Net.Http;

namespace SH.Room.Read.API.Controllers
{
    /// <summary>
    /// 房态
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RoomStateController : ControllerBase
    {
        private readonly IRoomStateServices _roomStateServices;

        /// <summary>
        /// 构造函数注入
        /// </summary>
        /// <param name="roomStateServices"></param>
        public RoomStateController(IRoomStateServices roomStateServices)
        {
            _roomStateServices = roomStateServices;
        }

        /// <summary>
        /// 房型下拉查询
        /// </summary>
        /// <returns>受影响行数</returns>
        [HttpGet]
        public IActionResult GetRoomTypeList()
        {
            var res=_roomStateServices.GetRoomTypeList();
            return Ok(res);
        }

        /// <summary>
        /// 房态筛序列表显示
        /// </summary>
        /// <returns>受影响行数</returns>
        [HttpGet]
        public IActionResult GetRoomStateList()
        {
            var result=_roomStateServices.GetRoomStateList();
            return Ok(result);
        }

        /// <summary>
        /// 更多筛选列表显示
        /// </summary>
        /// <returns>受影响行数</returns>
        [HttpGet]
        public IActionResult GetMoreScreenList()
        {
            var res= _roomStateServices.GetMoreScreenList();
            return Ok(res);
        }


        /// <summary>
        /// 房间展示列表
        /// </summary>
        /// <param name="rtid">房态ID</param>
        /// <param name="rsid">房态筛选ID</param>
        /// <param name="msid">更多筛选ID</param>
        /// <returns>受影响行数</returns>
        [HttpGet]
        public IActionResult GetRoomShowList(int rtid=-1, int rsid=-1, int msid=-1)
        {
            var res= _roomStateServices.GetRoomShowList(rtid, rsid, msid);
            return Ok(res);
        }

        /// <summary>
        /// 修改房间状态
        /// </summary>
        /// <param name="roomid">房间ID</param>
        /// <param name="Msid">房态ID</param>
        /// <returns>受影响行数</returns>
        [HttpPost]
        public IActionResult UpdState(int roomid, int Msid)
        {
            var res= _roomStateServices.UpdState(roomid, Msid);
            return Ok(res);
        }

        /// <summary>
        /// 房间数量统计
        /// </summary>
        /// <returns>受影响行数</returns>
        [HttpGet]
        public  IActionResult GetRoomCountList()
        {
            var res=  _roomStateServices.GetRoomCountList();
            return Ok(res);
        }
    }
}
